3.4.24 \(\int \cot ^4(c+d x) \sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x)) \, dx\) [324]

3.4.24.1 Optimal result
3.4.24.2 Mathematica [B] (verified)
3.4.24.3 Rubi [A] (warning: unable to verify)
3.4.24.4 Maple [B] (verified)
3.4.24.5 Fricas [B] (verification not implemented)
3.4.24.6 Sympy [F]
3.4.24.7 Maxima [F]
3.4.24.8 Giac [F(-1)]
3.4.24.9 Mupad [B] (verification not implemented)

3.4.24.1 Optimal result

Integrand size = 33, antiderivative size = 279 \[ \int \cot ^4(c+d x) \sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\frac {\left (8 a^2 A b-A b^3+16 a^3 B+2 a b^2 B\right ) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{8 a^{5/2} d}-\frac {\sqrt {a-i b} (i A+B) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a-i b}}\right )}{d}+\frac {\sqrt {a+i b} (i A-B) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a+i b}}\right )}{d}+\frac {\left (8 a^2 A+A b^2-2 a b B\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{8 a^2 d}-\frac {(A b+6 a B) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{12 a d}-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d} \]

output
1/8*(8*A*a^2*b-A*b^3+16*B*a^3+2*B*a*b^2)*arctanh((a+b*tan(d*x+c))^(1/2)/a^ 
(1/2))/a^(5/2)/d-(I*A+B)*arctanh((a+b*tan(d*x+c))^(1/2)/(a-I*b)^(1/2))*(a- 
I*b)^(1/2)/d+(I*A-B)*arctanh((a+b*tan(d*x+c))^(1/2)/(a+I*b)^(1/2))*(a+I*b) 
^(1/2)/d+1/8*(8*A*a^2+A*b^2-2*B*a*b)*cot(d*x+c)*(a+b*tan(d*x+c))^(1/2)/a^2 
/d-1/12*(A*b+6*B*a)*cot(d*x+c)^2*(a+b*tan(d*x+c))^(1/2)/a/d-1/3*A*cot(d*x+ 
c)^3*(a+b*tan(d*x+c))^(1/2)/d
 
3.4.24.2 Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(566\) vs. \(2(279)=558\).

Time = 6.49 (sec) , antiderivative size = 566, normalized size of antiderivative = 2.03 \[ \int \cot ^4(c+d x) \sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\frac {2 b^4 \left (\frac {5 A \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{16 a^{5/2} b}+\frac {(A b+a B) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{\sqrt {a} b^4}-\frac {3 (A b+a B) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{8 a^{5/2} b^2}-\frac {(a A-b B) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{2 a^{3/2} b^3}+\frac {\left (a A b-A b \sqrt {-b^2}-b^2 B-a \sqrt {-b^2} B\right ) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a-\sqrt {-b^2}}}\right )}{2 b^4 \sqrt {-b^2} \sqrt {a-\sqrt {-b^2}}}-\frac {\left (a A b+A b \sqrt {-b^2}-b^2 B+a \sqrt {-b^2} B\right ) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a+\sqrt {-b^2}}}\right )}{2 \left (-b^2\right )^{5/2} \sqrt {a+\sqrt {-b^2}}}-\frac {5 A \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{16 a^2 b^2}+\frac {3 (A b+a B) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{8 a^2 b^3}+\frac {(a A-b B) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{2 a b^4}+\frac {5 A \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{24 a b^3}-\frac {(A b+a B) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{4 a b^4}-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{6 b^4}\right )}{d} \]

input
Integrate[Cot[c + d*x]^4*Sqrt[a + b*Tan[c + d*x]]*(A + B*Tan[c + d*x]),x]
 
output
(2*b^4*((5*A*ArcTanh[Sqrt[a + b*Tan[c + d*x]]/Sqrt[a]])/(16*a^(5/2)*b) + ( 
(A*b + a*B)*ArcTanh[Sqrt[a + b*Tan[c + d*x]]/Sqrt[a]])/(Sqrt[a]*b^4) - (3* 
(A*b + a*B)*ArcTanh[Sqrt[a + b*Tan[c + d*x]]/Sqrt[a]])/(8*a^(5/2)*b^2) - ( 
(a*A - b*B)*ArcTanh[Sqrt[a + b*Tan[c + d*x]]/Sqrt[a]])/(2*a^(3/2)*b^3) + ( 
(a*A*b - A*b*Sqrt[-b^2] - b^2*B - a*Sqrt[-b^2]*B)*ArcTanh[Sqrt[a + b*Tan[c 
 + d*x]]/Sqrt[a - Sqrt[-b^2]]])/(2*b^4*Sqrt[-b^2]*Sqrt[a - Sqrt[-b^2]]) - 
((a*A*b + A*b*Sqrt[-b^2] - b^2*B + a*Sqrt[-b^2]*B)*ArcTanh[Sqrt[a + b*Tan[ 
c + d*x]]/Sqrt[a + Sqrt[-b^2]]])/(2*(-b^2)^(5/2)*Sqrt[a + Sqrt[-b^2]]) - ( 
5*A*Cot[c + d*x]*Sqrt[a + b*Tan[c + d*x]])/(16*a^2*b^2) + (3*(A*b + a*B)*C 
ot[c + d*x]*Sqrt[a + b*Tan[c + d*x]])/(8*a^2*b^3) + ((a*A - b*B)*Cot[c + d 
*x]*Sqrt[a + b*Tan[c + d*x]])/(2*a*b^4) + (5*A*Cot[c + d*x]^2*Sqrt[a + b*T 
an[c + d*x]])/(24*a*b^3) - ((A*b + a*B)*Cot[c + d*x]^2*Sqrt[a + b*Tan[c + 
d*x]])/(4*a*b^4) - (A*Cot[c + d*x]^3*Sqrt[a + b*Tan[c + d*x]])/(6*b^4)))/d
 
3.4.24.3 Rubi [A] (warning: unable to verify)

Time = 2.31 (sec) , antiderivative size = 286, normalized size of antiderivative = 1.03, number of steps used = 23, number of rules used = 22, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.667, Rules used = {3042, 4091, 27, 3042, 4132, 27, 3042, 4132, 27, 3042, 4136, 27, 3042, 4022, 3042, 4020, 25, 73, 221, 4117, 73, 221}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \cot ^4(c+d x) \sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x))}{\tan (c+d x)^4}dx\)

\(\Big \downarrow \) 4091

\(\displaystyle -\frac {1}{3} \int -\frac {\cot ^3(c+d x) \left (-5 A b \tan ^2(c+d x)-6 (a A-b B) \tan (c+d x)+A b+6 a B\right )}{2 \sqrt {a+b \tan (c+d x)}}dx-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {1}{6} \int \frac {\cot ^3(c+d x) \left (-5 A b \tan ^2(c+d x)-6 (a A-b B) \tan (c+d x)+A b+6 a B\right )}{\sqrt {a+b \tan (c+d x)}}dx-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{6} \int \frac {-5 A b \tan (c+d x)^2-6 (a A-b B) \tan (c+d x)+A b+6 a B}{\tan (c+d x)^3 \sqrt {a+b \tan (c+d x)}}dx-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 4132

\(\displaystyle \frac {1}{6} \left (-\frac {\int \frac {3 \cot ^2(c+d x) \left (8 A a^2-2 b B a+8 (A b+a B) \tan (c+d x) a+A b^2+b (A b+6 a B) \tan ^2(c+d x)\right )}{2 \sqrt {a+b \tan (c+d x)}}dx}{2 a}-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}\right )-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {1}{6} \left (-\frac {3 \int \frac {\cot ^2(c+d x) \left (8 A a^2-2 b B a+8 (A b+a B) \tan (c+d x) a+A b^2+b (A b+6 a B) \tan ^2(c+d x)\right )}{\sqrt {a+b \tan (c+d x)}}dx}{4 a}-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}\right )-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{6} \left (-\frac {3 \int \frac {8 A a^2-2 b B a+8 (A b+a B) \tan (c+d x) a+A b^2+b (A b+6 a B) \tan (c+d x)^2}{\tan (c+d x)^2 \sqrt {a+b \tan (c+d x)}}dx}{4 a}-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}\right )-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 4132

\(\displaystyle \frac {1}{6} \left (-\frac {3 \left (-\frac {\int -\frac {\cot (c+d x) \left (16 B a^3+8 A b a^2-16 (a A-b B) \tan (c+d x) a^2+2 b^2 B a-A b^3-b \left (8 A a^2-2 b B a+A b^2\right ) \tan ^2(c+d x)\right )}{2 \sqrt {a+b \tan (c+d x)}}dx}{a}-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}\right )}{4 a}-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}\right )-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {1}{6} \left (-\frac {3 \left (\frac {\int \frac {\cot (c+d x) \left (16 B a^3+8 A b a^2-16 (a A-b B) \tan (c+d x) a^2+2 b^2 B a-A b^3-b \left (8 A a^2-2 b B a+A b^2\right ) \tan ^2(c+d x)\right )}{\sqrt {a+b \tan (c+d x)}}dx}{2 a}-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}\right )}{4 a}-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}\right )-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{6} \left (-\frac {3 \left (\frac {\int \frac {16 B a^3+8 A b a^2-16 (a A-b B) \tan (c+d x) a^2+2 b^2 B a-A b^3-b \left (8 A a^2-2 b B a+A b^2\right ) \tan (c+d x)^2}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx}{2 a}-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}\right )}{4 a}-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}\right )-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 4136

\(\displaystyle \frac {1}{6} \left (-\frac {3 \left (\frac {\int -\frac {16 \left ((a A-b B) a^2+(A b+a B) \tan (c+d x) a^2\right )}{\sqrt {a+b \tan (c+d x)}}dx+\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\cot (c+d x) \left (\tan ^2(c+d x)+1\right )}{\sqrt {a+b \tan (c+d x)}}dx}{2 a}-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}\right )}{4 a}-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}\right )-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {1}{6} \left (-\frac {3 \left (\frac {\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\cot (c+d x) \left (\tan ^2(c+d x)+1\right )}{\sqrt {a+b \tan (c+d x)}}dx-16 \int \frac {(a A-b B) a^2+(A b+a B) \tan (c+d x) a^2}{\sqrt {a+b \tan (c+d x)}}dx}{2 a}-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}\right )}{4 a}-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}\right )-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{6} \left (-\frac {3 \left (\frac {\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\tan (c+d x)^2+1}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx-16 \int \frac {(a A-b B) a^2+(A b+a B) \tan (c+d x) a^2}{\sqrt {a+b \tan (c+d x)}}dx}{2 a}-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}\right )}{4 a}-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}\right )-\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}\)

\(\Big \downarrow \) 4022

\(\displaystyle -\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}+\frac {1}{6} \left (-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}-\frac {3 \left (-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}+\frac {\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\tan (c+d x)^2+1}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx-16 \left (\frac {1}{2} a^2 (a+i b) (A+i B) \int \frac {1-i \tan (c+d x)}{\sqrt {a+b \tan (c+d x)}}dx+\frac {1}{2} a^2 (a-i b) (A-i B) \int \frac {i \tan (c+d x)+1}{\sqrt {a+b \tan (c+d x)}}dx\right )}{2 a}\right )}{4 a}\right )\)

\(\Big \downarrow \) 3042

\(\displaystyle -\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}+\frac {1}{6} \left (-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}-\frac {3 \left (-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}+\frac {\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\tan (c+d x)^2+1}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx-16 \left (\frac {1}{2} a^2 (a+i b) (A+i B) \int \frac {1-i \tan (c+d x)}{\sqrt {a+b \tan (c+d x)}}dx+\frac {1}{2} a^2 (a-i b) (A-i B) \int \frac {i \tan (c+d x)+1}{\sqrt {a+b \tan (c+d x)}}dx\right )}{2 a}\right )}{4 a}\right )\)

\(\Big \downarrow \) 4020

\(\displaystyle -\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}+\frac {1}{6} \left (-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}-\frac {3 \left (-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}+\frac {\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\tan (c+d x)^2+1}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx-16 \left (\frac {i a^2 (a-i b) (A-i B) \int -\frac {1}{(1-i \tan (c+d x)) \sqrt {a+b \tan (c+d x)}}d(i \tan (c+d x))}{2 d}-\frac {i a^2 (a+i b) (A+i B) \int -\frac {1}{(i \tan (c+d x)+1) \sqrt {a+b \tan (c+d x)}}d(-i \tan (c+d x))}{2 d}\right )}{2 a}\right )}{4 a}\right )\)

\(\Big \downarrow \) 25

\(\displaystyle -\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}+\frac {1}{6} \left (-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}-\frac {3 \left (-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}+\frac {\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\tan (c+d x)^2+1}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx-16 \left (\frac {i a^2 (a+i b) (A+i B) \int \frac {1}{(i \tan (c+d x)+1) \sqrt {a+b \tan (c+d x)}}d(-i \tan (c+d x))}{2 d}-\frac {i a^2 (a-i b) (A-i B) \int \frac {1}{(1-i \tan (c+d x)) \sqrt {a+b \tan (c+d x)}}d(i \tan (c+d x))}{2 d}\right )}{2 a}\right )}{4 a}\right )\)

\(\Big \downarrow \) 73

\(\displaystyle -\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}+\frac {1}{6} \left (-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}-\frac {3 \left (-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}+\frac {\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\tan (c+d x)^2+1}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx-16 \left (\frac {a^2 (a+i b) (A+i B) \int \frac {1}{-\frac {i \tan ^2(c+d x)}{b}-\frac {i a}{b}+1}d\sqrt {a+b \tan (c+d x)}}{b d}+\frac {a^2 (a-i b) (A-i B) \int \frac {1}{\frac {i \tan ^2(c+d x)}{b}+\frac {i a}{b}+1}d\sqrt {a+b \tan (c+d x)}}{b d}\right )}{2 a}\right )}{4 a}\right )\)

\(\Big \downarrow \) 221

\(\displaystyle -\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}+\frac {1}{6} \left (-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}-\frac {3 \left (-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}+\frac {\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\tan (c+d x)^2+1}{\tan (c+d x) \sqrt {a+b \tan (c+d x)}}dx-16 \left (\frac {a^2 \sqrt {a-i b} (A-i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a-i b}}\right )}{d}+\frac {a^2 \sqrt {a+i b} (A+i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a+i b}}\right )}{d}\right )}{2 a}\right )}{4 a}\right )\)

\(\Big \downarrow \) 4117

\(\displaystyle -\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}+\frac {1}{6} \left (-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}-\frac {3 \left (-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}+\frac {\frac {\left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {\cot (c+d x)}{\sqrt {a+b \tan (c+d x)}}d\tan (c+d x)}{d}-16 \left (\frac {a^2 \sqrt {a-i b} (A-i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a-i b}}\right )}{d}+\frac {a^2 \sqrt {a+i b} (A+i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a+i b}}\right )}{d}\right )}{2 a}\right )}{4 a}\right )\)

\(\Big \downarrow \) 73

\(\displaystyle -\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}+\frac {1}{6} \left (-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}-\frac {3 \left (-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}+\frac {\frac {2 \left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \int \frac {1}{\frac {a+b \tan (c+d x)}{b}-\frac {a}{b}}d\sqrt {a+b \tan (c+d x)}}{b d}-16 \left (\frac {a^2 \sqrt {a-i b} (A-i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a-i b}}\right )}{d}+\frac {a^2 \sqrt {a+i b} (A+i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a+i b}}\right )}{d}\right )}{2 a}\right )}{4 a}\right )\)

\(\Big \downarrow \) 221

\(\displaystyle -\frac {A \cot ^3(c+d x) \sqrt {a+b \tan (c+d x)}}{3 d}+\frac {1}{6} \left (-\frac {(6 a B+A b) \cot ^2(c+d x) \sqrt {a+b \tan (c+d x)}}{2 a d}-\frac {3 \left (-\frac {\left (8 a^2 A-2 a b B+A b^2\right ) \cot (c+d x) \sqrt {a+b \tan (c+d x)}}{a d}+\frac {-\frac {2 \left (16 a^3 B+8 a^2 A b+2 a b^2 B-A b^3\right ) \text {arctanh}\left (\frac {\sqrt {a+b \tan (c+d x)}}{\sqrt {a}}\right )}{\sqrt {a} d}-16 \left (\frac {a^2 \sqrt {a-i b} (A-i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a-i b}}\right )}{d}+\frac {a^2 \sqrt {a+i b} (A+i B) \arctan \left (\frac {\tan (c+d x)}{\sqrt {a+i b}}\right )}{d}\right )}{2 a}\right )}{4 a}\right )\)

input
Int[Cot[c + d*x]^4*Sqrt[a + b*Tan[c + d*x]]*(A + B*Tan[c + d*x]),x]
 
output
-1/3*(A*Cot[c + d*x]^3*Sqrt[a + b*Tan[c + d*x]])/d + (-1/2*((A*b + 6*a*B)* 
Cot[c + d*x]^2*Sqrt[a + b*Tan[c + d*x]])/(a*d) - (3*((-16*((a^2*Sqrt[a - I 
*b]*(A - I*B)*ArcTan[Tan[c + d*x]/Sqrt[a - I*b]])/d + (a^2*Sqrt[a + I*b]*( 
A + I*B)*ArcTan[Tan[c + d*x]/Sqrt[a + I*b]])/d) - (2*(8*a^2*A*b - A*b^3 + 
16*a^3*B + 2*a*b^2*B)*ArcTanh[Sqrt[a + b*Tan[c + d*x]]/Sqrt[a]])/(Sqrt[a]* 
d))/(2*a) - ((8*a^2*A + A*b^2 - 2*a*b*B)*Cot[c + d*x]*Sqrt[a + b*Tan[c + d 
*x]])/(a*d)))/(4*a))/6
 

3.4.24.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 73
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[ 
{p = Denominator[m]}, Simp[p/b   Subst[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + 
 d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] && Lt 
Q[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntL 
inearQ[a, b, c, d, m, n, x]
 

rule 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4020
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[c*(d/f)   Subst[Int[(a + (b/d)*x)^m/(d^2 + 
c*x), x], x, d*Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[ 
b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[c^2 + d^2, 0]
 

rule 4022
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)]), x_Symbol] :> Simp[(c + I*d)/2   Int[(a + b*Tan[e + f*x])^m*( 
1 - I*Tan[e + f*x]), x], x] + Simp[(c - I*d)/2   Int[(a + b*Tan[e + f*x])^m 
*(1 + I*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c 
 - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] &&  !IntegerQ[m]
 

rule 4091
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + 
 (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Si 
mp[(A*b - a*B)*(a + b*Tan[e + f*x])^(m + 1)*((c + d*Tan[e + f*x])^n/(f*(m + 
 1)*(a^2 + b^2))), x] + Simp[1/(b*(m + 1)*(a^2 + b^2))   Int[(a + b*Tan[e + 
 f*x])^(m + 1)*(c + d*Tan[e + f*x])^(n - 1)*Simp[b*B*(b*c*(m + 1) + a*d*n) 
+ A*b*(a*c*(m + 1) - b*d*n) - b*(A*(b*c - a*d) - B*(a*c + b*d))*(m + 1)*Tan 
[e + f*x] - b*d*(A*b - a*B)*(m + n + 1)*Tan[e + f*x]^2, x], x], x] /; FreeQ 
[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && 
NeQ[c^2 + d^2, 0] && LtQ[m, -1] && LtQ[0, n, 1] && (IntegerQ[m] || Integers 
Q[2*m, 2*n])
 

rule 4117
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) 
+ (f_.)*(x_)])^(n_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> 
 Simp[A/f   Subst[Int[(a + b*x)^m*(c + d*x)^n, x], x, Tan[e + f*x]], x] /; 
FreeQ[{a, b, c, d, e, f, A, C, m, n}, x] && EqQ[A, C]
 

rule 4132
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) 
 + (f_.)*(x_)]^2), x_Symbol] :> Simp[(A*b^2 - a*(b*B - a*C))*(a + b*Tan[e + 
 f*x])^(m + 1)*((c + d*Tan[e + f*x])^(n + 1)/(f*(m + 1)*(b*c - a*d)*(a^2 + 
b^2))), x] + Simp[1/((m + 1)*(b*c - a*d)*(a^2 + b^2))   Int[(a + b*Tan[e + 
f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Simp[A*(a*(b*c - a*d)*(m + 1) - b^2*d* 
(m + n + 2)) + (b*B - a*C)*(b*c*(m + 1) + a*d*(n + 1)) - (m + 1)*(b*c - a*d 
)*(A*b - a*B - b*C)*Tan[e + f*x] - d*(A*b^2 - a*(b*B - a*C))*(m + n + 2)*Ta 
n[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, n}, x] && NeQ 
[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && LtQ[m, -1] && 
!(ILtQ[n, -1] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))
 

rule 4136
Int[(((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2))/((a_.) + (b_.)*tan[(e_.) 
+ (f_.)*(x_)]), x_Symbol] :> Simp[1/(a^2 + b^2)   Int[(c + d*Tan[e + f*x])^ 
n*Simp[b*B + a*(A - C) + (a*B - b*(A - C))*Tan[e + f*x], x], x], x] + Simp[ 
(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2)   Int[(c + d*Tan[e + f*x])^n*((1 + Tan[ 
e + f*x]^2)/(a + b*Tan[e + f*x])), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, 
 C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] & 
&  !GtQ[n, 0] &&  !LeQ[n, -1]
 
3.4.24.4 Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(1294\) vs. \(2(241)=482\).

Time = 0.23 (sec) , antiderivative size = 1295, normalized size of antiderivative = 4.64

method result size
derivativedivides \(\text {Expression too large to display}\) \(1295\)
default \(\text {Expression too large to display}\) \(1295\)

input
int(cot(d*x+c)^4*(a+b*tan(d*x+c))^(1/2)*(A+B*tan(d*x+c)),x,method=_RETURNV 
ERBOSE)
 
output
-1/4/d/b*ln(b*tan(d*x+c)+a+(a+b*tan(d*x+c))^(1/2)*(2*(a^2+b^2)^(1/2)+2*a)^ 
(1/2)+(a^2+b^2)^(1/2))*A*(2*(a^2+b^2)^(1/2)+2*a)^(1/2)*(a^2+b^2)^(1/2)+1/4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
(2*(a^2+b^2)^(1/2)+2*a)^(1/2)+1/d/(2*(a^2+b^2)^(1/2)-2*a)^(1/2)*arctan(((2 
*(a^2+b^2)^(1/2)+2*a)^(1/2)-2*(a+b*tan(d*x+c))^(1/2))/(2*(a^2+b^2)^(1/2)-2 
*a)^(1/2))*B*(a^2+b^2)^(1/2)-1/d*b/(2*(a^2+b^2)^(1/2)-2*a)^(1/2)*arctan((( 
2*(a^2+b^2)^(1/2)+2*a)^(1/2)-2*(a+b*tan(d*x+c))^(1/2))/(2*(a^2+b^2)^(1/...
 
3.4.24.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1376 vs. \(2 (235) = 470\).

Time = 9.35 (sec) , antiderivative size = 2769, normalized size of antiderivative = 9.92 \[ \int \cot ^4(c+d x) \sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\text {Too large to display} \]

input
integrate(cot(d*x+c)^4*(a+b*tan(d*x+c))^(1/2)*(A+B*tan(d*x+c)),x, algorith 
m="fricas")
 
output
[-1/48*(24*a^3*d*sqrt((2*A*B*b + d^2*sqrt(-(4*A^2*B^2*a^2 + 4*(A^3*B - A*B 
^3)*a*b + (A^4 - 2*A^2*B^2 + B^4)*b^2)/d^4) - (A^2 - B^2)*a)/d^2)*log(-(2* 
(A^3*B + A*B^3)*a + (A^4 - B^4)*b)*sqrt(b*tan(d*x + c) + a) + (A*d^3*sqrt( 
-(4*A^2*B^2*a^2 + 4*(A^3*B - A*B^3)*a*b + (A^4 - 2*A^2*B^2 + B^4)*b^2)/d^4 
) - (2*A*B^2*a + (A^2*B - B^3)*b)*d)*sqrt((2*A*B*b + d^2*sqrt(-(4*A^2*B^2* 
a^2 + 4*(A^3*B - A*B^3)*a*b + (A^4 - 2*A^2*B^2 + B^4)*b^2)/d^4) - (A^2 - B 
^2)*a)/d^2))*tan(d*x + c)^3 - 24*a^3*d*sqrt((2*A*B*b + d^2*sqrt(-(4*A^2*B^ 
2*a^2 + 4*(A^3*B - A*B^3)*a*b + (A^4 - 2*A^2*B^2 + B^4)*b^2)/d^4) - (A^2 - 
 B^2)*a)/d^2)*log(-(2*(A^3*B + A*B^3)*a + (A^4 - B^4)*b)*sqrt(b*tan(d*x + 
c) + a) - (A*d^3*sqrt(-(4*A^2*B^2*a^2 + 4*(A^3*B - A*B^3)*a*b + (A^4 - 2*A 
^2*B^2 + B^4)*b^2)/d^4) - (2*A*B^2*a + (A^2*B - B^3)*b)*d)*sqrt((2*A*B*b + 
 d^2*sqrt(-(4*A^2*B^2*a^2 + 4*(A^3*B - A*B^3)*a*b + (A^4 - 2*A^2*B^2 + B^4 
)*b^2)/d^4) - (A^2 - B^2)*a)/d^2))*tan(d*x + c)^3 - 24*a^3*d*sqrt((2*A*B*b 
 - d^2*sqrt(-(4*A^2*B^2*a^2 + 4*(A^3*B - A*B^3)*a*b + (A^4 - 2*A^2*B^2 + B 
^4)*b^2)/d^4) - (A^2 - B^2)*a)/d^2)*log(-(2*(A^3*B + A*B^3)*a + (A^4 - B^4 
)*b)*sqrt(b*tan(d*x + c) + a) + (A*d^3*sqrt(-(4*A^2*B^2*a^2 + 4*(A^3*B - A 
*B^3)*a*b + (A^4 - 2*A^2*B^2 + B^4)*b^2)/d^4) + (2*A*B^2*a + (A^2*B - B^3) 
*b)*d)*sqrt((2*A*B*b - d^2*sqrt(-(4*A^2*B^2*a^2 + 4*(A^3*B - A*B^3)*a*b + 
(A^4 - 2*A^2*B^2 + B^4)*b^2)/d^4) - (A^2 - B^2)*a)/d^2))*tan(d*x + c)^3 + 
24*a^3*d*sqrt((2*A*B*b - d^2*sqrt(-(4*A^2*B^2*a^2 + 4*(A^3*B - A*B^3)*a...
 
3.4.24.6 Sympy [F]

\[ \int \cot ^4(c+d x) \sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\int \left (A + B \tan {\left (c + d x \right )}\right ) \sqrt {a + b \tan {\left (c + d x \right )}} \cot ^{4}{\left (c + d x \right )}\, dx \]

input
integrate(cot(d*x+c)**4*(a+b*tan(d*x+c))**(1/2)*(A+B*tan(d*x+c)),x)
 
output
Integral((A + B*tan(c + d*x))*sqrt(a + b*tan(c + d*x))*cot(c + d*x)**4, x)
 
3.4.24.7 Maxima [F]

\[ \int \cot ^4(c+d x) \sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\int { {\left (B \tan \left (d x + c\right ) + A\right )} \sqrt {b \tan \left (d x + c\right ) + a} \cot \left (d x + c\right )^{4} \,d x } \]

input
integrate(cot(d*x+c)^4*(a+b*tan(d*x+c))^(1/2)*(A+B*tan(d*x+c)),x, algorith 
m="maxima")
 
output
integrate((B*tan(d*x + c) + A)*sqrt(b*tan(d*x + c) + a)*cot(d*x + c)^4, x)
 
3.4.24.8 Giac [F(-1)]

Timed out. \[ \int \cot ^4(c+d x) \sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\text {Timed out} \]

input
integrate(cot(d*x+c)^4*(a+b*tan(d*x+c))^(1/2)*(A+B*tan(d*x+c)),x, algorith 
m="giac")
 
output
Timed out
 
3.4.24.9 Mupad [B] (verification not implemented)

Time = 9.61 (sec) , antiderivative size = 16796, normalized size of antiderivative = 60.20 \[ \int \cot ^4(c+d x) \sqrt {a+b \tan (c+d x)} (A+B \tan (c+d x)) \, dx=\text {Too large to display} \]

input
int(cot(c + d*x)^4*(A + B*tan(c + d*x))*(a + b*tan(c + d*x))^(1/2),x)
 
output
atan(((((((224*A*a^4*b^11*d^4 - 32*A*a^2*b^13*d^4 + 256*A*a^6*b^9*d^4 + 64 
*B*a^3*b^12*d^4 + 448*B*a^5*b^10*d^4 + 384*B*a^7*b^8*d^4)/(a^4*d^5) - ((20 
48*a^4*b^10*d^4 + 3072*a^6*b^8*d^4)*(a + b*tan(c + d*x))^(1/2)*((B^2*a)/(4 
*d^2) - (A^2*a)/(4*d^2) - (2*A^2*B^2*b^2*d^4 - B^4*b^2*d^4 - 4*A^2*B^2*a^2 
*d^4 - A^4*b^2*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